package com.lxn;


import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 支付微服务
 */
@SpringBootApplication
@EnableCircuitBreaker//开启hystrix
public class PayServerApplication2000{
    public static void main( String[] args ){
        SpringApplication.run(PayServerApplication2000.class);
    }
    @LoadBalanced//负载均衡
    @Bean
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
    //随机负载均衡
    @Bean
    public IRule randomRule(){
        return new RandomRule();
    }
}
